﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Data;

/// <summary>
/// Summary description for ControlClass
/// </summary>
public class ControlClass
{

    class_database db;

	public ControlClass()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    protected void AddDataToDropDownList(DropDownList ddl, string tableName, string fieldValue, string fieldName)
    {
        string sql = "SELECT " + fieldName + ", " + fieldValue + " FROM " + tableName;
        db = new class_database();
        DataTable dt = db.GetDataTable(sql);
        ddl.Items.Clear();
        if (dt != null && dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                ddl.Items.Add(new ListItem(dt.Rows[i][fieldName].ToString(), dt.Rows[i][fieldValue].ToString()));
            }
        }
    }

    protected WebControl GetControlFromRepeater(WebControl webControl, Repeater rpt, string IDWebControl)
    {
        foreach (RepeaterItem item in rpt.Items)
        {
            
        }
        return webControl;
    }

}